package com.ytlz.dmcs.model.system.entity;

import java.util.Date;
import java.util.List;

import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

@Document(collection="sys_user")
public class SysUser {
	@Id
	private String id;

	@Indexed(unique = true)
	private String username;
	
	private String displayname;

	private String password;
	
	private String mail;
	
	@Field("create_date")
	private Date createDate;
	
	@Field("modify_date")
	private Date modifyDate;

	@DBRef
	private List<SysRole> roles;

	@PersistenceConstructor
	public SysUser(String username,String displayname, String password) {
		this.username= username;
		this.displayname = displayname;
		this.password = password;
	}
	
	@PersistenceConstructor
	public SysUser(String username,String displayname,String mail, String password) {
		this.username= username;
		this.displayname = displayname;
		this.mail = mail;
		this.password = password;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getDisplayname() {
		return displayname;
	}

	public void setDisplayname(String displayname) {
		this.displayname = displayname;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public List<SysRole> getRoles() {
		return roles;
	}

	public void setRoles(List<SysRole> roles) {
		this.roles = roles;
	}
	
	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getModifyDate() {
		return modifyDate;
	}

	public void setModifyDate(Date modifyDate) {
		this.modifyDate = modifyDate;
	}

}
